# 1. 要求 cmake 最低版本
cmake_minimum_required(VERSION 3.6)
# 添加工程名称
project(BookServer)

# 2. 设置编译参数
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/libs)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)

# 3. 添加源码文件
set(srcs main.cpp network/server.cpp)

# 4. 添加子模块目录
include_directories(base)
include_directories(database)
include_directories(network)
include_directories(appConfig)
include_directories(/usr/include)
include_directories(/usr/include/mysql)

# 5. 添加 libhv 库
include_directories(/usr/local/include/hv)
link_libraries(/usr/local/lib)

# 6. 添加子工程目录
add_subdirectory(appConfig)
add_subdirectory(base)
add_subdirectory(database)
add_subdirectory(test)

# 7. 编译生成
add_executable(BookServer ${srcs})
target_link_libraries(BookServer AppConfig)
target_link_libraries(BookServer hv)
target_link_libraries(BookServer DBManager)
target_link_libraries(BookServer Base)